home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / utils / colors70.zip / COLORS.PAS < prev   
Pascal/Delphi Source File  |  1996-04-08  |  3KB  |  110 lines

  1. program Colors;
  2.  
  3. {$N-,E-,Q+,S+,R+,I-,O-,F+,P+,T-,X-,V-,B+,A+,G+,D-,L-,Y-}
  4. {$M 1024,0,4081}
  5. {$L Bgi256}
  6.  
  7. (* Compiled in Borland Turbo Pascal 7.0 for DOS. Bgi256.Obj is a non-Borland
  8.    aftermarket add-on file. It is "registered", meaning the Bgi256.Obj file
  9.    itself isn't needed to run Squirmy Dots. *)
  10.  
  11. uses crt,drivers,graph;
  12.  
  13. var
  14. Gd, Gm, Error, Milliseconds : integer;
  15. Adjuster : char;
  16.  
  17. label Top, Start;
  18.  
  19. (* Gm := 0 is 320x200x256, 1 is 640x400x256, 2 is 640x480x256,
  20.          3 is 800x600x256, 4 is 1024x768x256, 5 is 1280x1024x256 *)
  21.  
  22. procedure Bgi256proc; external;
  23.  
  24. procedure InitBGI256;
  25. begin
  26. Gd := installuserdriver('Bgi256',nil);
  27. Error := registerbgidriver(@Bgi256proc);
  28. Gm := 0;  (* Run in 320x200x256 mode *)
  29. end;
  30.  
  31. procedure Exit_Program;
  32. begin
  33. closegraph;
  34. textcolor(7);
  35. textbackground(0);
  36. clrscr;
  37. gotoxy(1,3);
  38. textcolor(9);
  39. writeln('I hope you like playing this screen saver; Colors....');
  40. writeln;
  41. donesyserror;
  42. halt;
  43. end;
  44.  
  45. begin
  46. initsyserror;   (* Turns off ctrl-break, in drivers unit. *)
  47. Adjuster := 'A';
  48. textcolor(7);
  49. textbackground(1);
  50. Top:
  51. clrscr;
  52. gotoxy(1,3);
  53. writeln(' This program is a simple screen saver. What it does is put up one of up to');
  54. writeln(' 262,144 shades of color from black to white. It randomly chooses the color');
  55. writeln(' using 6 bits each for red green and blue (18-bit color). It holds each color');
  56. writeln(' for a random timeframe up to your millisecond entry. Requires only a 80286');
  57. writeln(' or up and 256k of ram on the video card, and a color monitor. Below you will');
  58. writeln(' determine the longest interval of time Colors can leave up any certain color.');
  59. writeln(' Your entry is in milliseconds, from 100 to 1250 (0.1 second to 1.25 seconds).');
  60. writeln(' Lower numbers will produce more rapid flickering. Colors will choose a random');
  61. writeln(' value between 0 milliseconds and your entry to show each color. If you press');
  62. writeln(' the N key (for New screen), you return to the menu to enter a new upper delay');
  63. writeln(' value. It randomly chooses to display each color from 0 milliseconds to your');
  64. write(' your entry for milliseconds. Any other key exits Colors. Have fun');
  65. textcolor(135);
  66. writeln('!');
  67. textcolor(7);
  68. writeln;
  69. writeln(' Enter a whole number between 100 and 1250 (or 0 to exit)');
  70. write(' ────>  ');
  71. reset(input);
  72. if not eoln(input) then
  73. read(Milliseconds) else goto Top;
  74.  
  75. if ioresult = 106 then goto Top;
  76.  
  77. if Milliseconds = 0 then Exit_Program;
  78.  
  79. if (Milliseconds < 100) or (Milliseconds > 1250) then goto Top;
  80.  
  81. if Adjuster = 'A' then InitBgi256;
  82.  
  83. initgraph(Gd,Gm,'');
  84. Error := graphresult;
  85. if Error <> 0 then
  86. begin
  87. closegraph;
  88. writeln('                                                         ');
  89. writeln(' Sorry, your display and/or video card is incompatible   ');
  90. writeln(' with this screen saver program. Oh, well; No harm done. ');
  91. writeln('                                                         ');
  92. halt(1);
  93. end;
  94.  
  95. Start:
  96. repeat
  97. setrgbpalette(0, Random(64), Random(64), Random(64));
  98. delay(Random(Milliseconds));
  99. delay(1);
  100. until keypressed;
  101.  
  102. Adjuster := readkey;
  103.  
  104. if (Adjuster = 'n') or (Adjuster = 'N') then
  105. begin
  106. closegraph;
  107. goto Top;
  108. end else Exit_Program;
  109.  
  110. end.